<script setup>
import { ref, reactive, onMounted } from 'vue';

const { config } = defineProps({
  config: {
    type: Object,
    required: true,
  }
});
const emits = defineEmits(['change']);

onMounted(() => {
  
});

const data = config.multiple ? ref(config.value || []) : ref(config.value || '');

const handleChange = () => {
  if (config.multiple) {
    const str = data.value.join('，');
    emits('change', str);
  } else {
    emits('change', data.value);
  }
}
</script>

<template>
  <el-select v-model="data" :multiple="config.multiple" @change="handleChange">
    <el-option v-for="item in config.sqlArrs" :label="item" :value="item"></el-option>
  </el-select>
</template>

<style lang="scss" scoped>

</style>